<template>
  <div class="authentication">
    <div class="com-top-nav">
      <van-nav-bar
        title="工作经历"
        left-arrow
        @click-left="onClickLeft"
      />
    </div>
    <div>

      <div v-for="(item,i) in info" :Key="i" class="work-experience-items" @click="goDetail(item.id)">
        <img src="../../../../static/img/ed.svg" alt="">
        <p class="title">{{item.company}}</p>
        <p class="name">{{item.position}}</p>
        <p class="time">{{item.start_time}} 至 {{item.end_time}} {{item.address}}</p>
        <div class="content ellipsis-2">
          {{item.des}}
        </div>
      </div>
      <div class="button">
        <van-button size="large" @click="handleSubmit">添加工作经历</van-button>
      </div>

    </div>
  </div>
</template>
<script>

  export default {
    data(){
      return {
          info:[]
      }
    },
    mounted() {},
    created(){
      this.init()
    },
    methods: {
      onClickLeft() {
        this.$router.go(-1);
      },
      handleSubmit() {
        this.$router.push({name: 'addWorkExperience', params:{workId:-1}});
      },
      goDetail(workId) {
        this.$router.push({name: 'addWorkExperience', params:{workId}});
      },
      init(){

        // this.axios.get('/api/user/job/show,{params:{uid:}).then())
        let uid = JSON.parse(sessionStorage.getItem('user')).uid;

        this.axios.get('/api/user/job/show',{params:{uid}}).then(res=>{
            if(res.data.err_code == 0){
              this.info =res.data.data;
              console.log(res.data)
            }
        }).catch(e=>{
          this.$toast({message:e})
        })
      }
    }
  }
</script>

<style scoped lang="less" type="text/less">
  @import url('../../../../static/style/var');

  .work-experience-items {
    position: relative;
    padding: 20px 50px 20px 10px;
    margin-bottom: 10px;
    background-color: #ffffff;
    line-height: 1.5;
    overflow: hidden;
    border-bottom: 1px solid @border-color-default;
    img {
      position: absolute;
      top: 20px;
      right: 20px;
      width: 25px;
      height: 25px;
    }
    .title {
      font-size: @title-font-size; /*px*/
      padding-bottom: 5px;
    }
    .name {
      font-size: @weak-tips-size; /*px*/
      color: @weak-tips-color;
    }
    .time {
      font-size: @weak-tips-size; /*px*/
      color: @weak-tips-color;
    }
    .content {
      font-size: @normal-font-size; /*px*/
      overflow: hidden;
      padding-top: 15px;
    }
  }

  .button {
    padding-left: 10px;
    padding-right: 10px;
    margin-top: 30px;
  }


</style>
